package com.xmx.common.exception;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2021/8/10 16:50
 * 1.为什么不继承Exception，而是继承RuntimeException
 *  1)RuntimeException 异常不一定要处理
 *  2)spring 事务异常(RuntimeException)回滚
 */
public class NMException extends  RuntimeException{
    private static final long serialVersionUID = 1L;

    private String msg;
    private int code = 500;

    public NMException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public NMException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }

    public NMException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public NMException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
